from django.core.mail import send_mail
from rest_framework.response import Response
from rest_framework.views import APIView

from userapp.sers import RegisterSer


class RegisterView(APIView):
    def post(self,request):
        ser = RegisterSer(data=request.data)

        if ser.is_valid():
            # ser.save()
            send_mail('征爹系统','我是邓建，在线征召个爹','1121259949@qq.com',recipient_list=['917896277@qq.com'])
            return Response({'msg':'注册成功','status':200})
        else:
            print(ser.errors)
            return Response({'msg':'注册失败','status':400,'errors':'ser.errors'})




